/* indent size: 2 */

module.exports = app => {
  const DataTypes = app.Sequelize;

  const Model = app.model.define('info_dorm', {
    dormitory_id: {
      type: DataTypes.INTEGER(10),
      allowNull: false,
      primaryKey: true,
      autoIncrement:true
    },
    department_id: {
      type: DataTypes.INTEGER(10),
      allowNull: false,
      references: {
        model: 'department',
        key: 'department_id'
      }
    },
    classify: {
      type: DataTypes.STRING(50),
      allowNull: false
    },
    dorm_name: {
      type: DataTypes.STRING(50),
      allowNull: false
    },
    dorm_category: {
      type: DataTypes.INTEGER(1),
      allowNull: false
    },
    dorm_location: {
      type: DataTypes.STRING(500),
      allowNull: false
    },
    status: {
      type: DataTypes.INTEGER(4),
      allowNull: false
    },
    create_time: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.literal('CURRENT_TIMESTAMP')
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.literal('CURRENT_TIMESTAMP')
    }
  }, {
    tableName: 'info_dorm'
  });

  Model.associate = function() {

  }

  return Model;
};
